package com.lin.blog.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lin.blog.entity.Category;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lin
 * @since 2020-03-08
 */
public interface CategoryMapper extends BaseMapper<Category> {


    /**
     *  通过parentId 获取 id.  既获取父ID下第一层子ID
     * @param parentId
     * @return
     */
    @Select("select id from category where  parent_id = #{parentId}")
    public List<Long> getCategoryIdByParentId(Long parentId);

}
